package com.aaa.depression.service;

import com.aaa.depression.dao.DepressionTestResultDao;
import com.aaa.pojo.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepressionTestResultServiceImpl implements DepressionTestResultService{
    @Autowired
    private DepressionTestResultDao depressionTestResultDao;

    @Override
    public ResultBean findAll(Page page, DepressionResult depressionResult) {
        PageHelper.startPage(page.getPage(), page.getLimit());

        //查数据

        List<DepressionResult> list = depressionTestResultDao.findAll(depressionResult);

        /* System.out.println("data"+list);*/

        PageInfo<DepressionResult> pageInfo=new PageInfo<DepressionResult>(list);

        return new ResultBean(0,"查询成功",pageInfo.getTotal(),pageInfo.getList());

    }

    @Override
    public Integer delete(@Param("id") Integer id) {
        return depressionTestResultDao.delete(id);
    }

    @Override
    public Integer deletes(@Param("id") Integer[] id) {
        return depressionTestResultDao.deletes(id);
    }

    @Override
    public DepressionResult check(DepressionResult depressionResult) {
        return depressionTestResultDao.check(depressionResult);
    }
}
